{$CLEO}
CONST
SCRIPT_POINTER = 0@
end
jump @start

0662: NOP "Screen Ratio Fix"
0662: NOP "Version: 1.0"
0662: NOP "Author: fastman92"
0662: NOP "Visit my site: fastman92.tk"

{$INCLUDE functions/Detect_EXE_version.txt}

:start
0A9F: SCRIPT_POINTER = current_thread_pointer
SCRIPT_POINTER += 0x10
0A8D: SCRIPT_POINTER = read_memory SCRIPT_POINTER size 4 virtual_protect FALSE      // Script content

0AB1: call_scm_func @GetAddress_setScreenAspectRatio 0 store_address_to 1@
0AB1: call_scm_func @asm_PutOnAddressJmpFarToLabel 4 script_content SCRIPT_POINTER source_address 1@ source_virtual_protect true destination @_setScreenAspectRatio

0AB1: call_scm_func @GetAddress_RwCurrentResolution 0 store_address_to 1@
0AB1: call_scm_func @asm_PutOnLabelAbsoluteAddressToAddress 4 script_content SCRIPT_POINTER source_label @_setScreenAspectRatio_fld_RwCurrentResolutionX_Address source_size 4 destination 1@
1@ += 4
0AB1: call_scm_func @asm_PutOnLabelAbsoluteAddressToAddress 4 script_content SCRIPT_POINTER source_label @_setScreenAspectRatio_fdiv_RwCurrentResolutionY_Address source_size 4 destination 1@

0AB1: call_scm_func @GetAddress_ScreenSizeRatio 0 store_address_to 1@
0AB1: call_scm_func @asm_PutOnLabelAbsoluteAddressToAddress 4 script_content SCRIPT_POINTER source_label @_setScreenAspectRatio_fst_ScreenSizeRatioAddress source_size 4 destination 1@
end_custom_thread

:_setScreenAspectRatio
hex
DB 05   // fld     dword ptr [_RwCurrentResolution_X]
end
:_setScreenAspectRatio_fld_RwCurrentResolutionX_Address
hex
00 00 00 00

DA 35   // fidiv     dword ptr [_RwCurrentResolution_Y]
end

:_setScreenAspectRatio_fdiv_RwCurrentResolutionY_Address
hex
00 00 00 00

D9 15   // fst      dword ptr [_ScreenSizeRatio]
end

:_setScreenAspectRatio_fst_ScreenSizeRatioAddress
hex
00 00 00 00 

C3
end

{$INCLUDE functions/ArrayGetValueByIndex.txt}
{$INCLUDE functions/asm_handling.txt}
{$INCLUDE general/Addresses.txt}